<?php
include_once "db.php";
include_once "checksession.php";
include_once "auth_permissions.php";

$browsers = mysql_query("select * FROM browser_type WHERE browser_type.status = '0' AND browser_type.hidden = '0'");
$inactive_browsers = mysql_query(" SELECT * FROM browser_type WHERE browser_type.status = '1' ");
$hidden_browsers = mysql_query(" SELECT * FROM browser_type WHERE browser_type.hidden = '1'");



authorize('admin');

?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<script type="text/javascript">
function show_confirm(id)
{
var r=confirm("Are you sure you want to delete id: "+id+"?");
if (r==true)
  {
  window.location= "delete_browser.php?BT_ID="+id;
  }
else
  {
  alert("Whew! you almost delelted something you probably shouldn't of.");
  }
}
</script>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>Modify Browsers</title>
<link href="meta-style.css" rel="stylesheet" type="text/css" />
</head>
<body>
<?php
include_once "topnav.php";
?>
<p class="title">Browser Types Active</p>
<form action="add_browser.php" method="post">
<table width="400" border="0" cellspacing="2" cellpadding="2">
<tr>
<td colspan="2">Add new browser:<br>(Enter browser name)</p></td>
</tr>
  <tr>
    <td><INPUT NAME="BT_desc" TYPE="TEXT" id="BT_desc" value="" SIZE="35"></td>
    <td><input type=SUBMIT value="Add New" name="SUBMIT"></td>
  </tr>
</table>
</form>
 <table width="700" border="1" cellpadding="3" cellspacing="0" bordercolor="#666666">
   <tr align="center" bgcolor=#999999>
     <td><strong>ID</strong></td>
     <td><strong>Browser Type</strong></td>
	 <td><strong>Action</strong></td>
   </tr>
 <?php 
		   while($results = mysql_fetch_array($browsers)) 
   {
		 echo "<tr align=left> \n";
		 echo "<td>" . $results[BT_ID] ."</td> \n";
		 echo "<td>" . $results[BT_desc] ."</td> \n";
		 echo "<td><a href=edit_browsers.php?BT_ID=" . $results[BT_ID] .">Edit</a> | <a onclick='show_confirm(".$results[BT_ID].")'  href='' >Delete</a> |  <a href='edit_browsers.php?BT_ID=" . $results[BT_ID] ."&deactivate=true'>deactivate</a>  | <a href=edit_browsers.php?BT_ID=" . $results[BT_ID] ."&hide=true>Hide From Form</a>    \n";
		 echo "</tr> \n";
	      }
	     ?> 
</table><br /><br />
<p> Inactive Types</p>
<table width="700" border="1" cellpadding="3" cellspacing="0" bordercolor="#666666">
   <tr align="center" bgcolor=#999999>
     <td><strong>ID</strong></td>
     <td><strong>Browser Type</strong></td>
	 <td><strong>Action</strong></td>
   </tr>
 <?php 
		   while($results = mysql_fetch_array($inactive_browsers)) 
   {
		 echo "<tr align=left> \n";
		 echo "<td>" . $results[BT_ID] ."</td> \n";
		 echo "<td>" . $results[BT_desc] ."</td> \n";
		 echo "<td><a href='edit_browsers.php?BT_ID=" . $results[BT_ID] ."&activate=true'>activate</a>  \n";
		 echo "</tr> \n";
	      }
	     ?> 
</table>

<br />
<br />
<p>Hidden Types</p>
<table width="700" border="1" cellpadding="3" cellspacing="0" bordercolor="#666666">
   <tr align="center" bgcolor=#999999>
     <td><strong>ID</strong></td>
     <td><strong>Problem Type</strong></td>
	 <td><strong>Action</strong></td>
   </tr>
 <?php 
		   while($results = mysql_fetch_array($hidden_browsers)) 
   {
		 echo "<tr align=left> \n";
		 echo "<td>" . $results[BT_ID] ."</td> \n";
		 echo "<td>" . $results[BT_desc] ."</td> \n";
		 echo "<td><a href=edit_browsers.php?BT_ID=" . $results[BT_ID] ."&show=true>Show</a> |  <a onclick='show_confirm(".$results[BT_ID].")'  href='' >Delete</a> \n";
		 echo "</tr> \n";
	      }
	     ?> 
</table>

 <p><a href="index.php">Back to Main Menu</a></p>
</body>
</html>
